<!DOCTYPE html>
<html lang="en" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/css/custom.form.css">
    <style>
        .layui-table-cell {
            padding:0 4px;
            height:auto;
            overflow:visible;
            text-overflow:inherit;
            white-space:normal;
            word-break: break-all;
            text-align: center;
        }
        .layui-table-box{
            overflow: visible;
        }
        .layui-table-box{
            overflow: visible;
        }
        .layui-table-header{
            overflow: visible;
        }
        .layui-table-box{
            overflow: visible;
        }
        .layui-table-main{
            overflow: visible;
        }
    </style>
</head>
<body>
<div>
    <div id="searchParam">
        <div class="layui-form-item">
            <div class="layui-input-inline">
                <input type="text" readonly class="layui-input" id="statisticsYear" placeholder="年份">
            </div>
            <div class="layui-input-inline layui-form">
                <select id="statisticsMonth">
                    <option value="0">全年</option>
                    <option value="-01-31">一月</option>
                    <option value="-02-28">二月</option>
                    <option value="-03-31">三月</option>
                    <option value="-04-30">四月</option>
                    <option value="-05-31">五月</option>
                    <option value="-06-30">六月</option>
                    <option value="-07-31">七月</option>
                    <option value="-08-31">八月</option>
                    <option value="-09-30">九月</option>
                    <option value="-10-31">十月</option>
                    <option value="-11-30">十一月</option>
                    <option value="-12-31">十二月</option>
                </select>
            </div>
            <div class="layui-input-inline ">
                <button class="layui-btn" onclick="search()" id="search">统计</button>
            </div>
        </div>

    </div>
    <!--    <table class="layui-hide" id="jcjf_table" lay-filter="jcjf_table"></table>-->
    <table  id="sltj_table" lay-filter="sltj_table"></table>
</div>
</body>
<script src="/layui/layui.all.js"></script>
<script src="/js/core.util.js"></script>
<script>
    //获取token
    var token = CoreUtil.getData("access_token");
    //地址栏转义token中的#号
    var tokenQuery = token.replace("#", "%23");
    var tableIns1;
    var table = layui.table;
    var form = layui.form;
    var layer = layui.layer;
    var $ = jQuery = layui.jquery;
    var laydate = layui.laydate;
    var tree = layui.tree;
    var startTime = null;
    var endTime = null;

    var currentDate = new Date();
    var currentYear=currentDate.getFullYear();
    var endYear = currentYear+4;
    layui.config({
        base: '/'
    }).extend({
        eleTree: 'layui-ext/eleTree/eleTree',
        tableMerge: 'layui-ext/tableMerge/tableMerge'
    }).use(['table', 'laypage', 'layer', 'laydate', 'tree', 'eleTree','tableMerge'], function () {
        tableIns1 = table.render({
            elem: '#sltj_table'
            , contentType: 'application/json'
            , headers: {"authorization": token}
            ,where:{statisticsYear:currentYear,statisticsMonth:'0'}
            , url: '/statistics/rukuStatistics' //数据接口
            , method: 'POST',title:'入库统计（万元）'
            , parseData: function (res) { //将原始数据解析成 table 组件所规定的数据
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.msg, //解析提示文本
                    "count": CoreUtil.isEmpty(res.data) ? 0 : res.data.total, //解析数据长度
                    "data": CoreUtil.isEmpty(res.data) ? null : res.data //解析数据列表
                }
            }
            , cols: [
                [
                    // {type: 'checkbox', fixed: 'left'},
                    {field: 'allMonth',title: '科室',width: 100,align:'center',rowspan:2},
                    {title: '科长',width: 200,align:'center',colspan: 5},
                    {title: '局长', width: 150,align:'center',colspan: 5},
                    {title: '复审', width: 150,align:'center',colspan: 5}
                ],
                [
                    {field: 'jcsankTotal', title: '应批', width: 80,align:'center',event:'kz_yp'}
                    ,{field: 'jcsikMonth', title: '未批', width: 80,align:'center',event:'kz_wp'}
                    ,{field: 'jcsikTotal', title: '通过', width: 80,align:'center',event:'kz_tg'}
                    ,{field: 'jcwkMonth', title: '拒绝', width: 80,align:'center',event:'kz_jj'}
                    ,{field: 'jcwkTotal', title: '超期（超过5个工作日审批）', width: 80,align:'center',
                    style:"color:red;border-right: 2px solid #ccc;",event:'kz_cq'}

                    ,{field: 'jcsankTotal', title: '应批', width: 80,align:'center',event:'jz_yp'}
                    ,{field: 'jcsikMonth', title: '未批', width: 80,align:'center',event:'jz_wp'}
                    ,{field: 'jcsikTotal', title: '通过', width: 80,align:'center',event:'jz_tg'}
                    ,{field: 'jcwkMonth', title: '拒绝', width: 80,align:'center',event:'jz_jj'}
                    ,{field: 'jcwkTotal', title: '超期（超过6个工作日审批）', width: 80,align:'center',
                    style:"color:red;border-right: 2px solid #ccc;",event:'jz_cq'},

                    {field: 'jcykMonth', title: '应批', width: 80,align:'center',event:'fs_yp'}
                    ,{field: 'jcykTotal', title: '未批', width: 80,align:'center',event:'fs_wp'}
                    ,{field: 'jcekMonth', title: '通过', width: 80,align:'center',event:'fs_tg'}
                    ,{field: 'jcekTotal', title: '拒绝', width: 80,align:'center',event:'fs_jj'}
                    ,{field: 'jcsankMonth', title: '超期（超过5个工作日审批）', width: 80,align:'center',
                    style:"color:red;border-right: 2px solid #ccc;",event:'fs_cq'}

                ]
            ], toolbar: '#toolbar'
            ,done: function(res, curr, count){
                // tableMerge.render(this)
            }
        });


        //工具条事件
        table.on('tool(sltj_table)', function(obj){ //注：tool 是工具条事件名，test 是 table 原始容器的属性 lay-filter="对应的值"
            var data = obj.data; //获得当前行数据
            //clickCbjfXz  clickRkjfXz clickSxjfXz
            var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
            console.log("审理统计当前点击的事件为：【"+layEvent+"】");
            // tableJcJfXz.reload({
            //     where: { //设定异步数据接口的额外参数，任意设
            //         statisticsYear: $("#statisticsYear").val(),
            //         statisticsMonth: $("#statisticsMonth").val(),
            //         swryDm:data.swryDm,
            //         loadOrNOT:"1"
            //     }
            // });
            // layer.open({
            //     type : 1,
            //     skin : 'layui-layer-molv',
            //     title : "积分明细",
            //     area : [ '100%', '100%' ],
            //     shade : 0.8,
            //     shadeClose : true,
            //     content : jQuery("#jcjfxz_div"),
            //     btn : [ '取消' ],
            // });
        });


        laydate.render({
            elem: '#statisticsYear',min:currentYear+'-01-01',max:endYear+'-12-31'
            , type: 'year', done: function (value, date, endDate) {
                if (value != null && value != undefined && value != "") {
                    startTime = value;
                } else {
                    startTime = null;
                }
            },value: '2023'
        });
    });

    //执行查询
    function search() {
        //这里以搜索为例
        tableIns1.reload({
            where: { //设定异步数据接口的额外参数，任意设
                statisticsYear: $("#statisticsYear").val(),
                statisticsMonth: $("#statisticsMonth").val(),
            }
        });
    }
</script>
</html>